const Sequelize = require('sequelize');
const config = require('./config')
const repository  = new Sequelize(config.db.schema, config.db.username, config.db.password, {
    host: config.db.host,
    port: config.db.port,
    dialect: 'mysql',
    pool: {
        max: 90,
        min: 0,
        idle: 10000
    },
    dialectOptions: {
        charset: 'utf8',
        collate: 'utf8_general_ci'
    }
});

repository.authenticate().then(()=>{
    console.log('Connection has been established successfully');
}).catch((err: any)=>{
    console.error('Unable to connec to the database:', err);
})

